<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>home</title>
    <script src="prototype.js"></script>
    <style>
    </style>
    <script>
        document.observe('dom:loaded', function() {
            $("add_currency").observe("click", function() {
		new Ajax.Request('/d/a/curr', {
		    method: 'get',	
		    parameters: {name: 'EUR', rate: 1.2},	
		    onSuccess: function(response) {
		        var data = response.responseText;
			alert(data);
		    }
		});
	    });
            $("query_currency").observe("click", function() {
		new Ajax.Request('/d/q/curr', {
		    method: 'get',	
		    onSuccess: function(response) {
		        // var data = JSON.parse(response.responseText);
		        // var data = eval('(' + response.responseText + ')');
		        var data = response.responseText.evalJSON();
			alert(data[0].id);
			//alert(response.responseText);
		    }
		});
	    });
	});
    </script>
</head>
<body>
Welcome Home
<div id="query_currency">query currency</div>
<div id="add_currency">add query</div>
</body>
</html>
